package com.ihr360.payroll.model.dto.staff;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ihr360.commons.model.entity.StringId;
import com.ihr360.payroll.type.SalaryProfileChangeType;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Index;
import javax.persistence.Table;
import java.util.Date;

/**
 * 员工薪资档案调整记录
 * @author richey
 */
@Entity
@Table(indexes = {
        @Index(name = "company_staff_fieldcode_effective", columnList = "companyId, staffId,fieldCode,effectiveAt", unique = true)})
public class StaffPayrollInfoJournal extends StringId {

    private static final long serialVersionUID = 5648001770010949512L;

    @Column(nullable = false)
    private String companyId;

    /**
     * 所属员工
     */
    @Column(nullable = false)
    private String staffId;

    /**
     * SalaryProfileField的code
     */
    @Column(nullable = false, length = 32,updatable = false)
    private String fieldCode;

    @Column(length = 50)
    private String fieldName;

    /**
     * 调整前的值
     */
    @Column
    private String oldValue;

    /**
     * 调整后的值
     */
    @Column
    private String newValue;

    /**
     * 处理人ID
     */
    @Column
    private String processorId;

    /**
     * 处理人姓名
     */
    private String processorName;

    /**
     * 处理日期
     */
    @Column(nullable = false)
    private Date createdAt;


    /**
     * 处理日期
     */
    @Column()
    private Date updateAt;

    /**
     * 调整原因
     */
    @Column
    private String reason;

    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @Column(columnDefinition = "date default 0",nullable = false)
    private Date effectiveAt;

    @Column
    @Enumerated(EnumType.STRING)
    private SalaryProfileChangeType changeType;


    /**
     * 是否是在员工薪资模块　手动调整
     */
    @Column
    private Boolean adjustManually;

    /**
     * 员工薪资档案数据是否已删除
     */
    @Column
    private Boolean isDeleted = false;



    public String getStaffId() {
        return staffId;
    }

    public void setStaffId(String staffId) {
        this.staffId = staffId;
    }

    public String getFieldCode() {
        return fieldCode;
    }

    public void setFieldCode(String fieldCode) {
        this.fieldCode = fieldCode;
    }

    public String getOldValue() {
        return oldValue;
    }

    public void setOldValue(String oldValue) {
        this.oldValue = oldValue;
    }

    public String getNewValue() {
        return newValue;
    }

    public void setNewValue(String newValue) {
        this.newValue = newValue;
    }

    public String getProcessorId() {
        return processorId;
    }

    public void setProcessorId(String processorId) {
        this.processorId = processorId;
    }

    public Date getCreatedAt() {
        return createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public String getReason() {
        return reason;
    }

    public void setReason(String reason) {
        this.reason = reason;
    }

    public String getCompanyId() {
        return companyId;
    }

    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }

    public Date getEffectiveAt() {
        return effectiveAt;
    }

    public void setEffectiveAt(Date effectiveAt) {
        this.effectiveAt = effectiveAt;
    }

    public SalaryProfileChangeType getChangeType() {
        return changeType;
    }

    public void setChangeType(SalaryProfileChangeType changeType) {
        this.changeType = changeType;
    }

    public String getFieldName() {
        return fieldName;
    }

    public void setFieldName(String fieldName) {
        this.fieldName = fieldName;
    }

    public Boolean getAdjustManually() {
        return adjustManually;
    }

    public void setAdjustManually(Boolean adjustManually) {
        this.adjustManually = adjustManually;
    }

    public String getProcessorName() {
        return processorName;
    }

    public void setProcessorName(String processorName) {
        this.processorName = processorName;
    }

    public Boolean getDeleted() {
        return isDeleted;
    }

    public void setDeleted(Boolean deleted) {
        isDeleted = deleted;
    }

    public Date getUpdateAt() {
        return updateAt;
    }

    public void setUpdateAt(Date updateAt) {
        this.updateAt = updateAt;
    }
}
